import request from "@/utils/request.js";
import qs from "qs";

const baseUrl = '/adam4/api/v1/monitorCurrentPrice'

/**
 * 分页查询
 */
function _page(params) {
  return new Promise((resolve, reject) => {
    request({
      url: baseUrl + "/page",
      method: "POST",
      data: params
    }).then((res) => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
};
export async function page(params) {
  let res = await _page(params);
  return res;
};

/**
 * 添加
 */
function _add(params) {
  return new Promise((resolve, reject) => {
    request({
      url: baseUrl + "/add",
      method: "POST",
      data: params
    }).then((res) => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
};
export async function add(params) {
  let res = await _add(params);
  return res;
};

/**
 * 关闭
 * @param {*} params 
 * @returns 
 */
function _stopMonitorCurrentPrice(params) {
  return new Promise((resolve, reject) => {
    request({
      url: baseUrl + "/stopMonitorCurrentPrice/" + params,
      method: "GET"
    }).then((res) => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
};
export async function stopMonitorCurrentPrice(params) {
  let res = await _stopMonitorCurrentPrice(params);
  return res;
};

/**
 * 删除
 * @param {*} params 
 * @returns 
 */
function _deleteMonitorCurrentPrice(params) {
  return new Promise((resolve, reject) => {
    request({
      url: baseUrl + "/deleteMonitorCurrentPrice/" + params,
      method: "GET"
    }).then((res) => {
      resolve(res)
    }).catch((err) => {
      reject(err)
    })
  })
};
export async function deleteMonitorCurrentPrice(params) {
  let res = await _deleteMonitorCurrentPrice(params);
  return res;
};